﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using WeChartWorkRobot.Common;
using WeChartWorkRobot.Model;
using WeChartWorkRobot.Model.DTO;
using WeChartWorkRobot.Model.Enum;

namespace WeChartWorkRobot.Service
{
    public class JiraRequestService
    {
        private CookieContainer _cookie;
        public JiraRequestService(CookieContainer cookie)
        {
            _cookie = cookie;
        }
        
        public List<JiraIssue> Query(string jiraHost,string queryStr)
        {
            MyHttpRequest myHttpRequest = new MyHttpRequest($"{jiraHost}/rest/api/2/search?jql={queryStr}", _cookie);
            JiraIssueResult jiraIssueResults = myHttpRequest.Get<JiraIssueResult>();
            return jiraIssueResults.issues;
        }
    }
}
